{template header}
<!--{if $TS_APP[options][isregister]=='2'}-->
<!--{else}-->
<link type="text/css" rel="stylesheet" href="{SITE_URL}app/{$app}/skins/{$skin}/validate.css" id="skin" />
<script src="{SITE_URL}public/js/validate/jquery.validateid.js" type="text/javascript"></script>

<script type="text/javascript">
$(document).ready(function() {
	
	var validator = $("#signupform").validate({
		onkeyup: false,
		rules:{
		<!--{if $TS_SITE['base']['isinvite']=='1'}-->
			invitecode:{
				required:true,
				remote:"{SITE_URL}index.php?app=user&ac=check&ts=isinvitecode"
			},
		<!--{/if}-->
			email: {
				required: true,
				email: true,
				remote: "{SITE_URL}index.php?app=user&ac=check&ts=inemail"
			},
			pwd: {
				required: true,
				minlength: 5
			},
			repwd: {
				required: true,
				minlength: 5,
				equalTo: "#pwd"
			},
			username:{
				required: true,
				minlength: 2,
				maxlength: 12,
				remote:"{SITE_URL}index.php?app=user&ac=check&ts=isusername"
			}
		},
		messages: {
		<!--{if $TS_SITE['base']['isinvite']=='1'}-->
			invitecode:{
				required:"请输入邀请码",
				remote:jQuery.format("邀请码无效，请寻找新的邀请码！")
			},
		<!--{/if}-->
			email: {
					required: "请输入Email地址",
					email: "请输入一个正确的Email地址",
					remote:jQuery.format("Email已经存在，请更换其他Email")
			},
			pwd: {
				required: "请输入密码",
				rangelength: jQuery.format("至少输入5个字符")
			},
			repwd: {
				required: "请重复输入密码",
				minlength: jQuery.format("两次输入密码不一致"),
				equalTo: "两次输入密码不一致"
			},
			username:{
				required:"请输入用户名",
				minlength: jQuery.format("至少输入2个字符"),
				maxlength: jQuery.format("最多输入12个字符"),
				remote:jQuery.format("用户名已经存在，请更换其他用户名")
			}
		},

		// the errorPlacement has to take the table layout into account
		errorPlacement: function(error, element) {
			if ( element.is(":radio") )
				error.appendTo( element.parent().next().next() );
			else if ( element.is(":checkbox") )
				error.appendTo ( element.next() );
			else
				error.appendTo( element.parent().next() );
		},

		success: function(label) {
			// set &nbsp; as text for IE
			label.html("&nbsp;").addClass("checked");
		}
	});

});
</script>

<script language="javascript">
function newgdcode(obj,url) {
obj.src = url+ '&nowtime=' + new Date().getTime();
//后面传递一个随机参数，否则在IE7和火狐下，不刷新图片
}
</script>

<!--{/if}-->

<!--main-->
<div class="midder">
<div class="mc">
<h1>用户注册</h1>
<!--{if $TS_APP[options][isregister]=='2'}-->
<p>系统升级中，暂时关闭用户注册！</p>
<p><a href="{SITE_URL}">[返回首页]</a></p>
<!--{else}-->
<p></p>
<form  id="signupform" method="POST" action="{SITE_URL}{tsUrl('user','register',array('ts'=>'do'))}">

<table width="100%" border="0" cellspacing="0" cellpadding="0"  class="Tabletext">

<!--{if $TS_SITE['base']['isinvite']=='1'}-->
<tr>
<td class="label"><label id="invitecode" for="invitecode">
<font color="red">邀请码：</font></label></td>
<td class="field" width="300"><input class="uinput" id="invitecode" name="invitecode" type="text" value="" /></td>
<td class="status"></td>
</tr>
<!--{/if}-->


<tr>
<td class="label"><label id="email" for="email">Email：</label></td>
<td class="field" width="300"><input class="uinput" id="email" name="email" type="text" value="" /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><label>密码：</label></td>
<td class="field"><input class="uinput" type="password" id="pwd" name="pwd"  /></td>
<td class="status"></td>
</tr>
<tr>
<td class="label"><label>重复密码：</label></td>
<td class="field"><input class="uinput" type="password" id="repwd" name="repwd"  /></td>
<td class="status"></td>
</tr>

<tr>
<td class="label"><label>用户名：</label></td>
<td class="field"><input class="uinput" type="text" id="username" name="username" /></td>
<td class="status"></td>
</tr>

<tr><td class="label">验证码：</td><td class="field"><input name="authcode" />
 <img src="{SITE_URL}index.php?app=user&ac=checkcode" onclick="javascript:newgdcode(this,this.src);" alt="点击刷新验证码" style="cursor:pointer;"/></td>
<td class="status"></td></tr>

<tr>
<td class="label"></td>
<td class="field">
<input type="hidden" name="fuserid" value="{$fuserid}" />
<input class="submit" type="submit" value="注册" /> 

<a href="{SITE_URL}{tsUrl('user','login')}">登录</a></td>
<td class="status"></td>
</tr>

<tr>
<td class="label"><br /></td>
<td class="field"><br />{php doAction('user_register_footer')}</td>
<td class="status"></td>
</tr>

</table>
</form>
<!--{/if}-->

</div>
</div>
{template footer}